<template>
  <el-card class="box-card" :body-style="{ padding: '0px' }">
    <div class="wrapper-dashboard-banner">
      <img src="@/assets/img/dashboard-tietu.svg" class="tietu-cover" />
      <div class="content">
        <h1 class="text-title">
          你好，<template v-if="profile">{{ profile?.username }}</template>
        </h1>
        <span class="text-sub">欢迎回来！</span>
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
import { useAuthStore } from '@/stores/auth';
import { storeToRefs } from 'pinia';

const authStore = useAuthStore();
const { profile } = storeToRefs(authStore);
</script>

<style lang="scss" scoped>
.box-card {
  margin-bottom: var(--el-main-padding);
}

.wrapper-dashboard-banner {
  display: flex;
  // flex-direction: column;
  // align-items: flex-start;
  // justify-content: center;
  align-items: center;
  height: 128px;
  padding: var(--main-space);

  background-image: url('@/assets/img/dashboard-banner.jpg');
  background-size: cover;
  background-position: center right;

  .tietu-cover {
    width: auto;
    height: 100%;
    margin-right: var(--main-space);
  }

  .content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
  }

  .text-title {
    font-size: 22px;
    color: rgba(0, 0, 0, 0.85);
    line-height: 28px;
    font-weight: 500;
    margin: 8px 0;
  }

  .text-sub {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.65);
    line-height: 24px;
    font-weight: 400;
  }
}
</style>
